/**
 * 通用窗口背景方法
 */
class Panel {


    // 背景
    private imgBg: eui.Image;
    // 标题
    private imgTitle: eui.Image;
    // 图标
    private imgIcon: eui.Image;


    public constructor(com: eui.Component) {
        this.imgBg = com['imgBg'];
        this.imgTitle = com['imgTitle'];
        this.imgIcon = com['imgIcon'];
    }


    /**
     * 设置标题
     * @param s 图片source
     */
    public setTitle(s: string) {
        this.imgTitle.source = s;
    }


    /**
     * 设置图标
     * @param s 图片source
     * @param v 是否显示图标
     */
    public setIcon(s: string, v: boolean = true) {
        v ? this.imgIcon.source = s : this.imgIcon.visible = v;
    }


    /**
     * 设置背景宽度
     * @param i 值
     */
    public setPanelWidth(i: number = 560) {
        this.imgBg.width = i;
    }


    /**
     * 设置背景高度
     * @param i 值
     */
    public setPanelHeight(i: number = 720) {
        this.imgBg.height = i;
    }


    /**
     * 隐藏图标
     */
    public hideIcon() {
        this.imgIcon.visible = false;
        this.imgTitle.x = null;
        this.imgTitle.horizontalCenter = 0;
    }
}